html = """
 
 <!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Beautiful Soup 练习页面</title>
    <meta name="description" content="这是一个用于练习爬虫的测试页面">
</head>
<body>
    <h1 class="main-title">Python 爬虫学习资源</h1>
    
    <div class="intro">
        <p>以下是常用的 Python 爬虫库介绍：</p>
        <ul id="library-list">
            <li class="library-item">
                <a href="https://requests.readthedocs.io/" target="_blank">Requests</a>
                <span class="desc">用于发送 HTTP 请求的库</span>
            </li>
            <li class="library-item">
                <a href="https://www.crummy.com/software/BeautifulSoup/" target="_blank">Beautiful Soup</a>
                <span class="desc">用于解析 HTML/XML 的库</span>
            </li>
            <li class="library-item">
                <a href="https://scrapy.org/" target="_blank">Scrapy</a>
                <span class="desc">强大的爬虫框架</span>
            </li>
        </ul>
    </div>

    <div class="tutorial">
        <h2>学习步骤</h2>
        <ol>
            <li>掌握基础 HTML 结构</li>
            <li>学习 Requests 发送请求</li>
            <li>使用 Beautiful Soup 解析数据</li>
            <li>实战爬取目标网站</li>
        </ol>
    </div>

    <div class="resources">
        <h2>推荐书籍</h2>
        <table border="1">
            <tr>
                <th>书名</th>
                <th>作者</th>
                <th>评分</th>
            </tr>
            <tr>
                <td>《Python 网络爬虫实战》</td>
                <td>张三</td>
                <td>4.8</td>
            </tr>
            <tr>
                <td>《Web 数据采集》</td>
                <td>李四</td>
                <td>4.6</td>
            </tr>
        </table>
    </div>

    <div class="images">
        <h2>相关图片</h2>
        <img src="python-logo.png" alt="Python 标志" class="logo">
        <img src="scrapy-logo.png" alt="Scrapy 标志" class="logo">
    </div>

    <footer>
        <p>© 2023 爬虫学习测试页面 | <a href="/about">关于我们</a></p>
    </footer>
</body>
</html>
 
 
 
 """


from bs4 import BeautifulSoup

soup = BeautifulSoup(html, "html.parser")

# re = soup.find("div" ,class_="resources")
# re1 = soup.find("div",attrs={"class":"resources"})
# # print(re1)
#
# li = soup.find("div",class_="tutorial")
# li1 = li.find_all("li")
# for i in li1:
#     print(i.text)

li = soup.find_all("span",attrs={"class":"desc"})
for li in li:
    print(li.text)

























